﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AdmLaboratorios.DTO;
using System.Data;

namespace AdmLaboratorios.DAO
{
    public class ValeConsumoDevolucionItemDAO : DAOBase<ValeConsumoDevolucionItemDTO>
    {
        public DataTable GetValeItemsTable(int id)
        {
            string qry = @"SELECT S.IdProducto, P.Nombre AS Producto, V.Cantidad, V.IdStock, V.Obs AS Observaciones
                            FROM ValeConsumoDevolucionItem V
                            JOIN Stock S ON V.IdStock = S.Id
                            JOIN Producto P ON S.IdProducto = P.Id";

            if (id != 0)
                qry = qry + " WHERE V.IdValeConsumoDevolucion=" + id.ToString();

            return GetTable(qry);
        }
    }
}
